#include "enroll.h"
#include "login.h"
#include "ui_enroll.h"

#include <QMessageBox>
#include <QSqlQuery>

Enroll::Enroll(QWidget* parent) :
    QWidget(parent),
    ui(new Ui::Enroll)
{
    ui->setupUi(this);
}

Enroll::~Enroll()
{
    delete ui;
}

void Enroll::on_pushButtonLogin_clicked()
{
    QString username = ui ->AddAccountNumber ->text();
    QString password = ui ->AddPassword ->text();

    QSqlQuery query;
    query.prepare("INSERT INTO users(UserName,Password) VALUES(?,?)");
    query.addBindValue(username);
    query.addBindValue(password);
    if(query.exec())
    {
        QMessageBox::warning(this, "成功！", "注册成功！！！");
    }


}

void Enroll::on_Return_clicked()
{
    login* m = new login();
    m->show();
    this->close();
}
